package chapter08_oop._interface;

/**
 * ClassName: InterfaceTest
 * Package: capter08._interface
 * Description:
 *
 * 接口
 *
 * @Author SherryAn
 * @Create 2025/7/21 19:31
 */
public class InterfaceTest {
    public static void main(String[] args) {
        System.out.println(Flyble.MIN_SPEED);
        System.out.println(Flyble.MAX_SPEED);

        Bullet b1=new Bullet();
        b1.attack();
        b1.fly();
    }
}

interface Flyble{//接口
//    全局常量
    public static final int MIN_SPEED = 0;
//    可以省略
    int MAX_SPEED = 7900;
//    方法可以省略public abstract
    public abstract void fly();
}

interface Attackable{//接口
    public abstract void attack();
}

abstract class Plane implements Flyble{

}

class Bullet implements Flyble,Attackable{

    @Override
    public void fly() {
        System.out.println("子弹飞");
    }

    @Override
    public void attack() {
        System.out.println("子弹可以攻击");
    }
}
//    测试接口的继承关系
interface AA{
    void method1();
}
interface BB{
    void method2();
}
interface CC extends AA,BB{//继承关系，且为多继承

}
class DD implements CC{

    @Override
    public void method1() {

    }

    @Override
    public void method2() {

    }
}